<?php

function smarty_function_get_teampost($params, &$smarty) {


  $topic_id = $params['topic_id'];

  if(isset($topic_id)){
      //Query data
      $pntables = pnDBGetTables();
      $table  = $pntables['innoforum_teamtopic'];
      $column = $pntables['innoforum_teamtopic_column'];

      $sql = "SELECT
                $table.$column[id],
                $table.$column[topic_id],  
                $table.$column[photographer_firstname],  
                $table.$column[photographer_lastname],  
                $table.$column[poster_firstname],  
                $table.$column[poster_lastname],  
                $table.$column[collator_firstname],  
                $table.$column[collator_lastname],  
                $table.$column[poster_ad_firstname],  
                $table.$column[poster_ad_lastname]
              FROM
                $table
              WHERE
                $table.$column[topic_id] = ".$topic_id;

      $column = array(
                        "id",
                        "topic_id",  
                        "photographer_firstname",  
                        "photographer_lastname",  
                        "poster_firstname",  
                        "poster_lastname",  
                        "collator_firstname",  
                        "collator_lastname",  
                        "poster_ad_firstname",  
                        "poster_ad_lastname"
                );
      $result = DBUtil::executeSQL($sql);

      $objectArray = DBUtil::marshallObjects ($result, $column);


      $smarty->assign('teamArray', $objectArray[0]); 

  }

}

